home *** CD-ROM | disk | FTP | other *** search
/ PC Master 5 / PC MASTER 5.iso / INTERNET / KIT / WIN95 / MSIE30.EXE / ieakjava.exe / classr.exe / com / ms / directX / dSoundBuffer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-31  |  3.1 KB  |  116 lines

  1. package com.ms.directX;
  2.  
  3. import com.ms.com.IUnknown;
  4.  
  5. public class dSoundBuffer implements IdSoundBuffer {
  6.    private byte[] getBuff(WaveFormatEx var1) {
  7.       byte[] var2 = new byte[var1.cbSize + 18];
  8.       this.setValInBuff(var2, 0, 2, var1.wFormatTag);
  9.       this.setValInBuff(var2, 2, 2, var1.nChannels);
  10.       this.setValInBuff(var2, 4, 4, var1.nSamplesPerSec);
  11.       this.setValInBuff(var2, 8, 4, var1.nAvgBytesPerSec);
  12.       this.setValInBuff(var2, 12, 2, var1.nBlockAlign);
  13.       this.setValInBuff(var2, 14, 2, var1.wBitsPerSample);
  14.       this.setValInBuff(var2, 16, 2, var1.cbSize);
  15.  
  16.       for(int var3 = 0; var3 < var1.cbSize; ++var3) {
  17.          var2[18 + var3] = var1.extra[var3];
  18.       }
  19.  
  20.       return var2;
  21.    }
  22.  
  23.    public native void Stop();
  24.  
  25.    public native void InternalSetObject(IUnknown var1);
  26.  
  27.    public native IUnknown InternalGetObject();
  28.  
  29.    public native void SetCurrentPosition(int var1);
  30.  
  31.    public native int GetPan();
  32.  
  33.    public native void SetPan(int var1);
  34.  
  35.    public native void GetCurrentPosition(DSCursors var1);
  36.  
  37.    public native int GetVolume();
  38.  
  39.    public native void SetVolume(int var1);
  40.  
  41.    private void setValInBuff(byte[] var1, int var2, int var3, int var4) {
  42.       var1[var2] = (byte)(var4 & 255);
  43.       var1[var2 + 1] = (byte)(var4 >> 8 & 255);
  44.       if (var3 > 2) {
  45.          var1[var2 + 2] = (byte)(var4 >> 16 & 255);
  46.          var1[var2 + 3] = (byte)(var4 >> 24 & 255);
  47.       }
  48.  
  49.    }
  50.  
  51.    private int getValFromBuff(byte[] var1, int var2, int var3) {
  52.       int var4 = 0;
  53.       var4 = var1[var2] + var1[var2 + 1] * 256;
  54.       if (var3 > 2) {
  55.          var4 += var1[var2 + 2] + var1[var2 + 3] * 256 << 16;
  56.       }
  57.  
  58.       return var4;
  59.    }
  60.  
  61.    public native void Initialize(dSound var1, DSBufferDesc var2, byte[] var3);
  62.  
  63.    public void Initialize(dSound var1, DSBufferDesc var2, WaveFormatEx var3) {
  64.       byte[] var4 = this.getBuff(var3);
  65.       this.Initialize(var1, var2, var4);
  66.    }
  67.  
  68.    public native void WriteBuffer(int var1, int var2, byte[] var3, int var4);
  69.  
  70.    public native void Restore();
  71.  
  72.    public native void GetCaps(DSBCaps var1);
  73.  
  74.    public native int GetFormatSize();
  75.  
  76.    public native void GetFormat(byte[] var1, int var2);
  77.  
  78.    public native int GetFrequency();
  79.  
  80.    public native void SetFormat(byte[] var1);
  81.  
  82.    public void SetFormat(WaveFormatEx var1) {
  83.       byte[] var2 = this.getBuff(var1);
  84.       this.SetFormat(var2);
  85.    }
  86.  
  87.    public native void Play(int var1, int var2, int var3);
  88.  
  89.    public WaveFormatEx GetFormat() {
  90.       int var1 = this.GetFormatSize();
  91.       byte[] var2 = new byte[var1];
  92.       this.GetFormat(var2, var1);
  93.       WaveFormatEx var3 = new WaveFormatEx();
  94.       var3.wFormatTag = this.getValFromBuff(var2, 0, 2);
  95.       var3.nChannels = this.getValFromBuff(var2, 2, 2);
  96.       var3.nSamplesPerSec = this.getValFromBuff(var2, 4, 4);
  97.       var3.nAvgBytesPerSec = this.getValFromBuff(var2, 8, 4);
  98.       var3.nBlockAlign = this.getValFromBuff(var2, 12, 2);
  99.       var3.wBitsPerSample = this.getValFromBuff(var2, 14, 2);
  100.       var3.cbSize = this.getValFromBuff(var2, 16, 2);
  101.       var3.extra = new byte[var3.cbSize];
  102.  
  103.       for(int var4 = 0; var4 < var3.cbSize; ++var4) {
  104.          var3.extra[var4] = var2[var4 + 18];
  105.       }
  106.  
  107.       return var3;
  108.    }
  109.  
  110.    public native int GetStatus();
  111.  
  112.    public native void TransferToSoundBuffer(DSResourceDesc var1, int var2);
  113.  
  114.    public native void SetFrequency(int var1);
  115. }
  116.